#ifndef __CAMERA_H__
#define __CAMERA_H__

#include "BasicType/BasicType.h"

namespace GCRE {
	namespace Rendering {
		
		class CCamera {
			public:
				CCamera();
				CCamera( const CCamera& c );
				~CCamera();

				CCamera& operator=( const CCamera& c );
				
				BasicType::SFVec3f GetViewPoint() const;
				BasicType::SFVec3f GetUpDirection() const;
				BasicType::SFVec3f GetAdvanceDirection() const;
				void SetViewPoint( const BasicType::SFVec3f& v );
				void SetUpDirection( const BasicType::SFVec3f& up );
				void SetAdvanceDirection( const BasicType::SFVec3f& advance );
				void LookAt( const BasicType::SFVec3f& target );

				BasicType::SFMatrix44f GetViewMatrix () const;
				void CalcViewMatrix();

			protected:

			private:
				BasicType::SFVec3f		m_ViewPoint;
				BasicType::SFVec3f		m_UpDirection;
				BasicType::SFVec3f		m_AdvanceDirection;

				BasicType::SFMatrix44f m_ViewMatrix;
		};

		inline BasicType::SFVec3f CCamera::GetViewPoint() const { return m_ViewPoint; }
		inline void CCamera::SetViewPoint( const BasicType::SFVec3f& v ) { m_ViewPoint = v; }
		inline BasicType::SFVec3f CCamera::GetUpDirection() const { return m_UpDirection; }
		inline void CCamera::SetUpDirection( const BasicType::SFVec3f& up ) { m_UpDirection = up; }
		inline BasicType::SFVec3f CCamera::GetAdvanceDirection() const { return m_AdvanceDirection; }
		inline void CCamera::SetAdvanceDirection( const BasicType::SFVec3f& advance ) { m_AdvanceDirection = advance; }
		inline void CCamera::LookAt( const BasicType::SFVec3f& target ) { m_AdvanceDirection = target - m_ViewPoint; m_AdvanceDirection.Normalize(); }
		inline BasicType::SFMatrix44f CCamera::GetViewMatrix() const { return m_ViewMatrix; }

	}
}

#endif	//	__CAMERA_H__